import { defineStore } from "pinia";

export const useBasics = defineStore("useBasics", {
  state: () => {
    return {
      log: {
        logs: [
          {
            dateTime: "2000-01-01 00:00:00",
            id: 1,
            ip: "0.0.0.0",
            type: "danger",
            content: "用户删除",
          },
          {
            dateTime: "2000-01-02 00:00:00",
            id: 2,
            ip: "127.0.0.1",
            type: "warning",
            content: "密码修改",
          },
          {
            dateTime: "2000-01-03 00:00:00",
            id: 3,
            ip: "192.168.1.1",
            type: "success",
            content: "文本编辑",
          },
          {
            dateTime: "2000-01-04 00:00:00",
            id: 4,
            ip: "255.255.255.0",
            type: "info",
            content: "页面跳转",
          },
        ] as any,
        logsForm: [] as any,
        //预警标签栏
        dangerLogs: [
          {
            id: 1,
            ip: "255.255.255.0",
            content: "删除用户",
            proposal: "建议删除用户前确保不再使用或者保存用户数据",
          },
          {
            id: 1,
            ip: "255.255.255.0",
            content: "删除用户",
            proposal: "建议删除用户前确保不再使用或者保存用户数据",
          },
          {
            id: 1,
            ip: "255.255.255.0",
            content: "删除用户",
            proposal: "建议删除用户前确保不再使用或者保存用户数据",
          },
          {
            id: 1,
            ip: "255.255.255.0",
            content: "删除用户",
            proposal: "建议删除用户前确保不再使用或者保存用户数据",
          },
          {
            id: 1,
            ip: "255.255.255.0",
            content: "删除用户",
            proposal: "建议删除用户前确保不再使用或者保存用户数据",
          },
        ] as any,
        totalStorage: 1024, //日志最大容量1024KB
        currentStorage: 128,
        isNotice: false,
        isVerification: false,
      },
    };
  },
  getters: {},
  actions: {
    logClearStorage() {
      this.log.logs = [];
      this.log.currentStorage = 0;
    },
  },
});
